<?php
/**
 * Copyright (c) 2016.  hangzhou BOYE .Co.Ltd. All rights reserved
 */

/**
 * Created by PhpStorm.
 * User: 1
 * Date: 2016-12-17
 * Time: 15:05
 */

namespace app\src\stores\logic;


use app\src\base\logic\BaseLogic;
use app\src\stores\model\StoresOrder;

class StoresOrderLogic extends BaseLogic
{
    public function _init()
    {
        $this->setModel(new StoresOrder());
    }

    public function query_order($map){

        $model=$this->getModel();

        $list=$model->alias('so')
            ->join('itboye_orders io','io.id=so.order_id','left')
            ->join('itboye_orders_contactinfo oc','oc.order_code=io.order_code','left')
            ->join(['common_member'=>'m'],'m.uid=io.uid','left')
            ->where($map)
            ->select();
        $data = [];
        foreach ($list as $vo){
            if(method_exists($vo,"toArray")){
                array_push($data,$vo->toArray());
            }
        }

        return $this -> apiReturnSuc($data);
    }

}